/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			props.h
  \date			Oct 2012
  \author		TNick

  \brief		Contains the definition for Props class


*//*


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Please read COPYING and README files in root folder
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __PROPS_INC__
#define __PROPS_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

#include	<cpg/cpg.h>
#include	<memtrack.h>
#include	<QList>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

class	PropBase;

/**
*	@brief	The singleton handles application properties
*/
class Props		: public MemTrack		{
	BBM_TRACK( Props );

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

public:

	/* the file is auto-generated by the props.py script */
#	include	"props_id.h"


	/**
	*	@brief	the type of properties that we know of
	*/
	enum		Types			{
		PROP_STRING,		/**< PropString */
		PROP_BOOL,			/**< PropBool */
		PROP_INTEGER,		/**< PropInt */
		PROP_REAL,			/**< PropReal */
		PROP_LIST,			/**< PropList */
		PROP_POINT,			/**< PropPoint */
		PROP_SIZE,			/**< PropSize */

		PROP_MAX			/**< for validation */
	};



	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:


	/**
	*	@brief	list of known properties
	*/
	QList<PropBase*>		list_;



	/**
	*	@brief	singleton
	*/
	static Props *			uniq_;


	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

private:


	/**
	*	@brief	constructor;
	*/
	Props			( void );


	/**
	*	@brief	destructor;
	*/
	~Props			( void );


	/**
	*	@brief	creates build-in PropBase instances and adds them to list
	*/
	void						createBuildIn			( void );



public:


	/**
	*	@brief	initialisation method
	*/
	static bool					init					( void );


	/**
	*	@brief	termination method
	*/
	static void					end						( void );


	/**
	*	@brief	termination method
	*/
	static inline Props *		unique					( void )
	{ return uniq_; }


	/**
	*	@brief	get the index of a PropBase or -1 if it was not found
	*/
	static int					indexOf					( PropBase * inst )
	{ return uniq_->list_.indexOf( inst ); }


	/**
	*	@brief	get the index of a PropBase or -1 if it was not found
	*/
	static PropBase*			propBase				( int idx )
	{
		if ( ( idx < 0 ) || ( idx >= uniq_->list_.count() ) )
			return NULL;
		return uniq_->list_.at( idx );
	}




	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class Props	*/

/*  CLASS    =============================================================== */
//
//
//
//
#endif // __PROPS_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */

